import { ref } from 'vue'

export function useLoadScript(src) {
  const loaded = ref(false)
  
  if (process.client) { // 仅在客户端执行
    const script = document.createElement('script')
    script.src = src
    script.onload = () => {
      loaded.value = true
    }
    document.head.appendChild(script)
  }

  return { loaded }
}